<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="include/base.jsp"  %>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<title>document</title>
	<link rel="stylesheet" href="css/bootstrap.min.css" />
	<link rel="stylesheet" href="css/style.css" />
</head>
<body>
	<div class="container">
		<%@ include file="include/top.jsp" %>
	<!--header end-->
		<div class="content">
			<div class="row">
				<div class="span9">
					<ul class="breadcrumb">
					  <li><a href="share.jspx"><i class="icon-folder-open"></i>文件共享</a> <span class="divider">/</span></li>
					  <li class="active">客户资料</li>
					  <li class="pull-right"><a href="uploadfile.jspx" class="btn btn-info"><i class="icon-arrow-up"></i>上传资料</a></li>
					</ul>
					<table class="table" style="border-top:1px solid #fff8dc">
					  <thead>
						<tr>
							<th width="5%"></th>
							<th width="30%">名称</th>
							<th width="30%">大小</th>
							<th>创建人</th>
							<th></th>
						</tr>
					  </thead>
					  <tbody>
					  <c:forEach items="${page.list}" var="file">
							<tr>
								<td><img src="img/file.png" alt="" /></td>
								<td><a href="download.jspx?id=${file.id}">${file.fileShowName}.${fn:substringAfter(file.fileName,".") }</a></td>
								<td>${file.fileSize}</td>
								<td>${file.employee.name }</td>
								<td><a href="javascript:;" rel="${file.id}" title="删除该文件" class="delfile"><i class="icon-trash"></i></a></td>
							</tr>
						</c:forEach>
						<c:if test="${empty page.list }">
							<tr><td colspan="5">还没有上传文件</td></tr>
						</c:if>
					  </tbody>
					</table>
					 <c:if test="${page.totalPage > 1 }">
	                <div class="pagination pull-right">
	                  <ul>
	                  <c:choose>
	                  	<c:when test="${page.pageNum ==1}">
	                    <li><a>首页</a></li>
	                    <li><a>上一页</a></li>
	                    </c:when>
	                    <c:otherwise>
	                    	<li><a href="singlefile.jspx?id=${folderId}&p=1">首页</a></li>
	                    	<li><a href="singlefile.jspx?id=${folderId}&p=${page.pageNum-1}">上一页</a></li>
	                    </c:otherwise>
	                    </c:choose>
	                     <c:choose>
	                  	<c:when test="${page.pageNum ==page.totalPage}">
	                    <li><a>下一页</a></li>
	                    <li><a>尾页</a></li>
	                    </c:when>
	                    <c:otherwise>
	                    	<li><a href="singlefile.jspx?id=${folderId}&p=${page.pageNum+1}">下一页</a></li>
	                    	<li><a href="singlefile.jspx?id=${folderId}&p=${page.totalPage}">尾页</a></li>
	                    </c:otherwise>
	                    </c:choose>
	                  </ul>
	                </div>
                </c:if>
					<a href="share.jspx">←返回</a>
				</div>
				<div class="span3">
					<c:if test="${not empty delfileerr}">
						<span style="color:red">${delfileerr }</span>
					</c:if>
					<c:remove var="delfileerr" scope="session"/>
				</div>
			</div>
		</div>
		<!--container end-->
		<%@ include file="include/footer.jsp"%>
		<!--footer end-->
	</div>
	
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript">
		$(function(){
			$(".delfile").click(function(){
				var id = $(this).attr("rel");//文件的id
				if(window.confirm("确定要删除文件吗？")){
					window.location="delfile.jspx?id="+id;
				}
			});
		});
		
	</script>
</body>
</html>